package gold.digger;

import gold.utils.InputUtil;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC812 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public double largestTriangleArea(int[][] points) {
            int N = points.length;
            double res = 0;
            for (int i = 0; i < N - 2; i++) {
                for (int j = i + 1; j < N - 1; j++) {
                    for (int k = j + 1; k < N; k++) {
                        int[] point1 = points[i];
                        int[] point2 = points[j];
                        int[] point3 = points[k];
                        int x1 = point1[0], y1 = point1[1];
                        int x2 = point2[0], y2 = point2[1];
                        int x3 = point3[0], y3 = point3[1];
                        res = Math.max(res, 0.5 * Math.abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)));
                    }
                }
            }
            return res;
        }
    }

    public void run() {
        int[] arr = InputUtil.toIntegerArray("[1,2,3]");
        System.out.println(new Solution().toString());
    }

    public static void main(String[] args) throws Exception {
        LC812 an = new LC812();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
